/*
 * Copyright Aduna (http://www.aduna-software.com/) (c) 2008-2009.
 *
 * Licensed under the Aduna BSD-style license.
 */
package edu.tju.rdfbase.store.helpers;

import edu.tju.rdfbase.store.NotifyingStoreConnection;
import edu.tju.rdfbase.store.StoreConnectionListener;

/**
 * Adds auto-commit functionality to store connections by wrapping updates with
 * calls to {@link #begin()} and {@link #commit()} when performed outside an
 * explicit transactions.
 * 
 * @author James Leigh
 * @author Arjohn Kampman
 */
public class AutoCommitNotifyingConnection extends AutoCommitStoreConnection implements
		NotifyingStoreConnection
{

	/*--------------*
	 * Constructors *
	 *--------------*/

	public AutoCommitNotifyingConnection(NotifyingStoreConnection con) {
		super(con);
	}

	/*---------*
	 * Methods *
	 *---------*/

	@Override
	protected NotifyingStoreConnection getDelegate() {
		return (NotifyingStoreConnection)super.getDelegate();
	}

	public void addConnectionListener(StoreConnectionListener listener) {
		getDelegate().addConnectionListener(listener);
	}

	public void removeConnectionListener(StoreConnectionListener listener) {
		getDelegate().removeConnectionListener(listener);
	}
}
